home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr27
/
dumps100.zip
/
DUMPS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-02-24
|
2KB
|
78 lines
{$I-}{$S-} (* Check IO with IOResult; disable stack checking *)
Program DumpScreen; (* Even works on screens larger than 80x25! *)
procedure showhelp(const problem :byte);
(* If any *foreseen* errors arise, we are sent here to
give a little help and exit (relatively) peacefully *)
const
progdesc = 'DumpScreen - Free DOS utility: '+
'Dump contents of entire screen to a text file.';
author = 'v1.00: February 24, 1995. '+
'(c) 1995 by David Daniel Anderson - Reign Ware.';
usage = 'Usage: DumpS <textfile>';
var
message : string[50];
begin
writeln(progdesc);
writeln(author); writeln;
writeln(usage); writeln;
if problem > 0 then begin
case problem of
1 : message:='Unexpected error opening or closing output file.';
else message:='Unanticipated error of unknown type.';
end;
writeln (#7,message);
end;
halt(problem)
end;
Procedure GotoXY(X,Y : Byte); Assembler;
(* From SWAG, unattributed *)
Asm
MOV DH, Y { DH = Row (Y) }
MOV DL, X { DL = Column (X) }
DEC DH { Adjust For Zero-based Bios routines }
DEC DL { Turbo Crt.GotoXY is 1-based }
MOV BH,0 { Display page 0 }
MOV AH,2 { Call For SET CURSOR POSITION }
INT 10h
end;
Function ScrnChar: Char;
(* From SWAG, unattributed *)
begin
Asm
push bx
mov ah,8
xor bx,bx
int 16
mov @Result,al
pop bx
end;
end;
var
scrncols: byte absolute $0040:$004a; {from Lou Duchez, found in SWAG}
scrnrows: byte absolute $0040:$0084; {from Lou Duchez, found in SWAG}
MaxX, MaxY : byte;
x,y: byte;
dumpfile: text;
BEGIN
if ParamCount <> 1 then showhelp(0);
assign(dumpfile, ParamStr(1));
rewrite(dumpfile); if ioresult <> 0 then showhelp(1);
MaxX := scrncols;
MaxY := scrnrows + 1;
For y := 1 to MaxY do begin
For x := 1 to MaxX do begin
GotoXY(x,y);
Write(dumpfile, ScrnChar);
end;
Writeln(dumpfile);
end;
close(dumpfile); if ioresult <> 0 then showhelp(1);
GotoXY(1,MaxY);
Writeln('Screen contents successfully saved in "',ParamStr(1),'".');
end.